import http from '../index'

// 分页获取车辆
export const getCars = ({ ascended = null, current = null, size = null, sortFieldName = null, status = null, carHead = null, carNumber = null, carState = null }) => {
    return http.get("cars", { ascended, current, size, sortFieldName, status, carHead, carNumber, carState })
}

// 根据sid获取车辆
export const getCarDetail = ({ sid }) => {
    return http.get("cars/" + sid)
}

// 根据sid查询车辆绑定的线路
export const getCarLines = ({ sid }) => {
    return http.get("cars/" + sid + '/lines')
}

// 根据车辆sid获取网点信息
export const getCarOutlet = ({ sid }) => {
    return http.get("cars/" + sid + '/outlets')
}

// 新增车辆
export const addCar = ({ carHead, carNumber, lineSid, outletsSid, note, status = null }) => {
    return http.post("cars", { carHead, carNumber, lineSid, outletsSid, note, status })
}

// 修改车辆
export const editCar = ({ sid, carHead, carNumber, lineSid, outletsSid, note, status = null }) => {
    return http.put("cars/" + sid, { carHead, carNumber, lineSid, outletsSid, note, status })
}

// 批量删除车辆
export const delCars = ({ sidList }) => {
    return http.put("cars/delete", { sidList })
}

// 更改车辆状态
export const changeCarState = ({ sid, carState }) => {
    return http.put("cars/car-state", { sid, carState })
}

// 根据sid启用-停用车辆
export const changeCarStatus = ({ sid }) => {
    return http.put("cars/" + sid + '/status')
}



